package com.yilin.tms.core.remote;


import com.yilin.tms.core.application.ReturnData;
import com.yilin.tms.core.commons.annotation.NoLoginSecurity;
import com.yilin.tms.core.components.interceptor.ReqProviderInterceptor;
import com.yilin.tms.core.entity.data.statistics.VehicleNoAuthStatistics;
import com.yilin.tms.core.entity.data.statistics.truck.VehicleStatistics;
import com.yilin.tms.core.entity.truck.TransportLicense;
import com.yilin.tms.core.entity.truck.TravelLicense;
import com.yilin.tms.core.entity.truck.TruckVehicle;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 远程调用 用户服务
 *
 * @author zhangjinyuan
 * @date 2022/10/29
 */
@FeignClient(name = "truck-service-provider", configuration = ReqProviderInterceptor.class)
public interface IVehicleRemote {

    /**
     * 根据车辆ID获取车辆
     */
    @PostMapping(value = "/truck/vehicle/getVehicleById")
    ReturnData<TruckVehicle> getVehicleById(@RequestParam(value = "vehicleId") String vehicleId);
    /**
     * 根据车辆ID获取车辆
     */
    @PostMapping(value = "/truck/vehicle/updateVehicle")
    ReturnData<TruckVehicle> updateVehicle(@RequestBody() TruckVehicle truckVehicle);
    /**
     * 获取组织车辆列表
     */
    @PostMapping(value = "/truck/vehicle/getVehicleListByOrganizeId")
    ReturnData<List<TruckVehicle>> getVehicleListByOrganizeId(@RequestParam(value = "organizeId") String organizeId);

    /**
     * 获取组织空闲车辆列表
     */
    @PostMapping(value = "/truck/vehicle/getUnUsedVehicleListByOrganizeId")
    @NoLoginSecurity
    ReturnData<List<TruckVehicle>> getUnUsedVehicleListByOrganizeId(@RequestParam("organizeId") String organizeId);

    /**
     * 根据车辆ID数组获取车辆
     * 批量获取车辆信息
     */
    @PostMapping(value = "/truck/vehicle/getVehicleListByIds")
    ReturnData<List<TruckVehicle>> getVehicleListByIds(@RequestParam("vehicleIds") String vehicleIds);

    /**
     * 根据车牌号获取车辆信息
     */
    @PostMapping(value = "/truck/vehicle/getTruckByTruckNo")
    ReturnData<TruckVehicle> getTruckByTruckNo(@RequestParam("trackNo") String trackNo);

    /**
     * 获取平台未生成或生产失败的数据
     */
    @PostMapping(value = "/truck/vehicle/getErrorTmsVehicle")
    ReturnData<List<TruckVehicle>> getErrorTmsVehicle();
    /**
     * 获取ETC未备案车辆：
     */
    @PostMapping(value = "/truck/vehicle/getEtcNoKeepTruck")
    ReturnData<List<TruckVehicle>> getEtcNoKeepTruck();

    /**
     * 3-1-更新车辆状态
     */
    @PostMapping(value = "/truck/vehicle/updateVehicleStatus")
    ReturnData<String> updateVehicleStatus(@RequestParam("vehicleId") String vehicleId, @RequestParam("truckStatus") TruckVehicle.TruckStatus truckStatus);
    /**
     * 3-2-更新车辆ETC备案状态
     */
    @PostMapping(value = "/truck/vehicle/updateVehicleStatus")
    ReturnData<String> updateVehicleStatus(@RequestParam("vehicleId")String vehicleId, @RequestParam("etcKeepStatus")TruckVehicle.EtcKeepStatus etcKeepStatus);

    /**
     * 3-3-更新车辆TMS创建状态
     */
    @PostMapping(value = "/truck/vehicle/updateVehicleStatus")
    ReturnData<Object> updateVehicleStatus(@RequestParam("vehicleId")String vehicleId, @RequestParam("tmsTruckDataState")TruckVehicle.TmsTruckDataState tmsTruckDataState);

    /**
     * 通过司机更新车辆定位
     */
    @PostMapping(value = "/truck/vehicle/updateVehiclePosition")
    ReturnData<Object> updateVehiclePosition(@RequestParam("truckUserId")String truckUserId, @RequestParam("position")String position);

    //-------------------------------------------------------车辆认证模块----------------------------------------------------------

    /**
     * 获取行驶证
     */
    @PostMapping(value = "/truck/auth/getTravelLicenseByVehicleId")
    ReturnData<TravelLicense> getTravelLicenseByVehicleId(@RequestParam("vehicleId") String vehicleId);

    /**
     * 获取行驶证2
     */
    @PostMapping(value = "/truck/auth/getTravelLicenseByVehicleNo")
    ReturnData<TravelLicense> getTravelLicenseByVehicleNo(@RequestParam("vehicleNo") String vehicleNo);

    /**
     * 获取运输证
     */
    @PostMapping(value = "/truck/auth/getTransportLicenseByVehicleId")
    ReturnData<TransportLicense> getTransportLicenseByVehicleId(@RequestParam("vehicleId") String vehicleId);


    //---------------------------------------------------------统计模块---------------------------------------------------------

    /**
     * 获取车辆证件待认证数据
     */
    @PostMapping(value = "/truck/statistics/getVehicleNoAuthStatistics")
    ReturnData<VehicleNoAuthStatistics> getVehicleNoAuthStatistics();

    /**
     * 获取车源统计数据
     */
    @PostMapping(value = "/truck/statistics/getVehicleStatistics")
    ReturnData<VehicleStatistics> getVehicleStatistics();

}
